package com.webshop.app;

import java.sql.Date;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.EntityTransaction;
import javax.persistence.Persistence;

import org.hibernate.SessionFactory;

import com.webshop.app.entity.Order;
import com.webshop.app.entity.util.HibernateUtil;

/**
 * Hello world!
 *
 */
public class App 
{
    public static void main( String[] args )
    {
    	EntityManagerFactory emf = Persistence.createEntityManagerFactory("webshoplocalPU");
    	EntityManager em =emf.createEntityManager();
    	EntityTransaction tx = em.getTransaction();
    	Order o = new Order();
    	tx.begin();
    	em.persist(o);
    	tx.commit();
    	
    	Order get = em.find(Order.class, o.getId());
    	System.out.println("i found this : " + get.toString());
    	
    	em.close();
    	emf.close();
    
    }
   
}
